<template>
	<view>
		<tm-upload
			:showSort="showSort"
			:onStart="onStart"
			:onSuccessAfter="true"
			v-model="list"
			ref="up"
			:width="width"
			:imageHeight="imageHeight"
			:rows="3"
			imageModel="aspectFill"
			:url="upload"
			@success="success"
			:disabled="disabled"
			@remove="remove"
			:maxFile="maxFile"
			:header="header"
			:color="color"
		>
		</tm-upload>
	</view>
</template>

<script lang="ts" setup>
import { ref, toRefs } from 'vue';
import {upload} from '@/utils/api'
const dateStr = ref('')
const showdate = ref(false)
const up = ref<InstanceType<typeof tmUpload> | null>(null)
const emit = defineEmits(['onSuccessAfter'])
const props = defineProps({
	width:Number,
	maxFile:Number,
	imageHeight:Number,
	list:Array,
	disabled:Boolean,
	showSort:Boolean,
	color:String
})
const header = ref({
	server:1,
	'ba-user-token':uni.getStorageSync('token')
})
const {width,imageHeight,list,disabled,showSort} = toRefs(props)
const success = (file:file,fileList)=>{
	emit('success',file,fileList)
}
const remove = (e)=>{
	emit('remove',e)
}
const onStart = (item: any) => {
	console.log(item)
	return true
}

</script>

<style>

</style>